<!-- !Main -->
<div id="main" class="sidebar-right"><!-- class="sidebar-none", class="sidebar-left", class="sidebar-right" -->

    <div class="wf-wrap">
        <div class="wf-container-main">

            <div id="content" role="main" class="content">

                <article class="post">

                    <h1 class="entry-title"><?php echo $post->title?></h1>
                    <div class="hr-breadcrumbs divider-heder">
                        <div class="assistive-text">You are here:</div>
                        <ol class="breadcrumbs wf-td text-small flat">
                            <li><a href="<?php echo $this->baseUrl?>">Home</a></li>
                            <li><a href="<?php echo $post->cat->url?>">blog</a></li>
                        </ol>
                    </div>
                    <div class="wf-container">
                        <div class="wf-cell wf-2-2">
                            <blockquote class="shortcode-pullquote align-left"><em><?php echo $post->desc?></em></blockquote>
                        </div>
                    </div>

                    <?php echo $post->content?>


                    <div class="gap-10"></div>
                    <div class="hr-thin"></div>
                    <div class="gap-10"></div>

                    <div class="wf-table wf-mobile-collapsed">
                        <div class="wf-td">
                            <div class="entry-meta">
                                <span class="assistive-text">Posted on</span>
                                <a href="#" title="<?php echo $post->createdTime?>" rel="bookmark">
                                    <time pubdate="<?php echo $post->created?>" datetime="<?php echo $post->created?>" class="entry-date"><?php echo $post->createdTime?></time>
                                </a>
                                <span class="assistive-text"><br></span>
                                <a class="author vcard" href="#" title="<?php echo $post->managerName?>" rel="author">By <?php echo $post->managerName?></a>
                                <span class="assistive-text"><br>In:</span>
                                <a href="<?php echo $post->catUrl?>" title="View all posts in <?php echo CHtml::encode($post->catName)?>" rel="category tag"><?php echo $post->catName?></a>
                                <span class="assistive-text"><br></span>
                                <?php /*<a href="#"><?php echo $post->fb_comment_count?> comments</a>*/?>
                            </div><!-- .entry-meta -->
                            <?php /*
                                <div class="entry-tags">
                                <span class="assistive-text">Tags:</span>
                                <a rel="tag" href="#">art</a>
                                <a rel="tag" href="#">fashion</a>                        
                                <a rel="tag" href="#">design</a>
                                <a rel="tag" href="#">web</a>
                                <a rel="tag" href="#">wordpress</a>
                                <a rel="tag" href="#">lifestyle</a>                            
                                </div><!-- .entry-tags -->
                            */?>
                        </div>
                        <div class="wf-td">

                            <div class="entry-share">
                                <div class="soc-ico">
                                    <div class="social-button-list">
                                        <span class="post-share">Share this on: </span>
                                        <div class="fb-like" data-href="<?php echo $post->urlID?>" data-width="80" data-layout="button_count" data-show-faces="false" data-send="false"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="gap-20"></div>
                    <div class="hr-thick flat"></div>
                    <div class="gap-30"></div>

                    <!-- Comments -->
                    <div id="comments" class="comments-area">
                        <h2 class="comments-title"><?php echo $post->fb_comment_count?> comments</h2>
                        <div class="fb-comments" data-href="<?php echo $post->urlID?>" data-width="470" data-num-posts="10"></div>
                    </div>
                    
                    <div class="gap-10"></div>
                    <div class="hr-thick flat"></div>
                    <div class="gap-10"></div>

                    <h2 class="entry-title">Related posts</h2>
                    <div class="gap-10"></div>

                    <!-- !-- Items grid -->
                    <section class="items-grid wf-container">
                        <?php foreach($post->relatedPosts as $relatedPost):?>
                            <div class="wf-cell wf-1-3">
                                <div class="borders">
                                    <article>
                                        <a href="<?php echo $relatedPost->url?>" class="alignleft post-rollover" title="<?php echo $relatedPost->titleEncode?>">
                                            <img src="<?php echo $relatedPost->imageUrlSmall?>" alt="<?php echo $relatedPost->titleEncode?>">
                                        </a>
                                        <div class="post-content">
                                            <a href="<?php echo $relatedPost->url?>"><?php echo $relatedPost->title?></a><br>
                                            <time pubdate="<?php echo $relatedPost->created?>" datetime="<?php echo $relatedPost->created?>" class="text-secondary"><?php echo $relatedPost->createdDate?></time>
                                        </div>
                                    </article>
                                </div>
                            </div>
                            <?php endforeach?>
                    </section><!-- .items-grid -->


                </article><!-- .post -->


            </div><!-- #content -->


            <?php $this->renderPartial('//common/sidebar');?>

        </div><!-- .wf-container -->
    </div><!-- .wf-wrap -->
</div><!-- #main -->




<?php if($hasVideo):?>
<script type="text/javascript" src="<?php echo $this->baseUrl?>/files/jwplayer/5.9/jwplayer.js"></script>
    <script type="text/javascript">
        $(function(){
            <?php if($hasVideo):?>
                var width = $('#content').width();
                var height = width * 9 / 16;
                console.log(width);
                console.log(height);
                var options = {
                    flashplayer: "<?php echo $this->baseUrl?>/files/jwplayer/5.9/player.swf", 
                    width: width,
                    height: height, 
                    skin: "<?php echo $this->baseUrl?>/files/jwplayer/skins/NewTube.zip",
                    autostart: false,
                } 
                $('.video-player').each(function(index){
                    options.file = $(this).attr('url');
                    options.autostart = $(this).attr('autostart');
                    var id =  'video-player-' + (index + 1);
                    $(this).attr('id', id)
                    jwplayer(id).setup(options);
                });

                $(window).resize(function() {
                    var width = $('#content').width();
                    var height = width * 9 / 16;
                    console.log(width);
                    console.log(height);


                    $("[id^='video-player-']").each(function(){
                        $(this).css('width', width);
                        $(this).css('height', height);
                    });
                });
                <?php endif?>
        })
    </script>
    <?php endif?>
